package com.ruoyi.web.controller.pay;

import java.util.List;

import com.ruoyi.community.domain.pay.PayStatistics;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.community.domain.PayHisHouse;
import com.ruoyi.community.service.IPayHisHouseService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * his_houseController
 * 
 * @author 韩宁
 * @date 2021-12-21
 */
@RestController
@RequestMapping("/community/hisHouse")
public class PayHisHouseController extends BaseController
{
    @Autowired
    private IPayHisHouseService payHisHouseService;

    /**
     * 查询his_house列表
     */
    @PreAuthorize("@ss.hasPermi('community:hisHouse:list')")
    @GetMapping("/list")
    public TableDataInfo list(PayHisHouse payHisHouse)
    {
        startPage();
        List<PayHisHouse> list = payHisHouseService.selectPayHisHouseList(payHisHouse);
        return getDataTable(list);
    }

    /**
     *  查询统计信息
     */
    @GetMapping("/statistics/{hisId}")
    public AjaxResult getInfoByCostId(@PathVariable Integer hisId) {
        return AjaxResult.success(payHisHouseService.getInfoByCostId(hisId));
    }
    /**
     * 导出his_house列表
     */
    @PreAuthorize("@ss.hasPermi('community:hisHouse:export')")
    @Log(title = "his_house", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(PayHisHouse payHisHouse)
    {
        List<PayHisHouse> list = payHisHouseService.selectPayHisHouseList(payHisHouse);
        ExcelUtil<PayHisHouse> util = new ExcelUtil<PayHisHouse>(PayHisHouse.class);
        return util.exportExcel(list, "his_house数据");
    }

/*    *//**
     * 获取his_house详细信息
     *//*
    @PreAuthorize("@ss.hasPermi('community:hisHouse:query')")
    @GetMapping(value = "/{hisId}")
    public AjaxResult getInfo(@PathVariable("hisId") Integer hisId)
    {
        return AjaxResult.success(payHisHouseService.selectPayHisHouseById(hisId));
    }

    *//**
     * 新增his_house
     *//*
    @PreAuthorize("@ss.hasPermi('community:hisHouse:add')")
    @Log(title = "his_house", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PayHisHouse payHisHouse)
    {
        return toAjax(payHisHouseService.insertPayHisHouse(payHisHouse));
    }

    *//**
     * 修改his_house
     *//*
    @PreAuthorize("@ss.hasPermi('community:hisHouse:edit')")
    @Log(title = "his_house", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PayHisHouse payHisHouse)
    {
        return toAjax(payHisHouseService.updatePayHisHouse(payHisHouse));
    }

    *//**
     * 删除his_house
     *//*
    @PreAuthorize("@ss.hasPermi('community:hisHouse:remove')")
    @Log(title = "his_house", businessType = BusinessType.DELETE)
	@DeleteMapping("/{hisIds}")
    public AjaxResult remove(@PathVariable Integer[] hisIds)
    {
        return toAjax(payHisHouseService.deletePayHisHouseByIds(hisIds));
    }*/
}
